open System

(*
let lines_of_file filename =
  seq {
    use stream = File.OpenRead filename
    use reader = new StreamReader(stream)
    while not reader.EndOfStream do
    yield reader.ReadLine() }
*)

let split seperator (text: string) =
  text.Split (Array.ofList seperator)
  |> List.ofArray

let wordCount (text: string) =
  let words = split [ ' '; '\n'; '\t' ] text
  printf "%A\n" words
  let wordSet = Set.ofList words
  let nWords = words.Length
  let nDups = words.Length - wordSet.Count
  (nWords, nDups)

let showWordCount text =
  let nWords, nDups = wordCount text
  printfn "%d words in the text" nWords
  printfn "%d duplicate words" nDups

let main =
  Console.In.ReadToEnd()
  |> showWordCount
